// pages/my/my.js
Page({

    /**
     * 页面的初始数据
     */
    data: {

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
      var that = this;
      if (wx.getStorageSync('userid')) {
        var role = wx.getStorageSync('role');
        console.log(role);
        wx.request({
          url: api.UserInfo,
          data: { mid: wx.getStorageSync('userid') },
          method: 'GET',
          success: function (res) {
            if (res.data.thumb != null) {

              that.setData({ image: res.data.thumb })
            }
            that.setData({ name: res.data.name })
            if (res.data.rules != null) {
              var rules = res.data.rules.split(',');
              var index = rules.indexOf('3');
              if (index < 0) {
                that.setData({ senddata: false })
              } else {
                that.setData({ senddata: true })
              }
            }

          },
        })
      } else {
        that.setData({
          denglu: false
        })
      }
    },
    logout: function () {
      wx.showModal({
        title: '',
        content: '是否退出登录?',
        showCancel: true,//是否显示取消按钮
        cancelText: "取消",//默认是“取消”
        cancelColor: '#999999',//取消文字的颜色
        confirmText: "确定",//默认是“确定”
        confirmColor: '#999999',//确定文字的颜色
        mask: true,
        success: function (res) {
          if (res.cancel) {
            //点击取消,默认隐藏弹框
          } else {
            //点击确定
            wx.clearStorage();
            wx.reLaunch({
              url: '/pages/signin/signin',
            })
          }
        },
      })
    },
    my4:function(){
      wx.navigateTo({
        url: '/pages/ys_order/ys_order',
      })
    },
    my5:function(){
      wx.navigateTo({
        url: '/pages/edit_ysda/edit_ysda',
      })
    },
    my6:function(){
      wx.navigateTo({
        url: '/pages/thinking/thinking',
      })
    },


    my1:function(){
      wx.navigateTo({
        url: '/pages/credit/credit',
      })
    },
    my2:function(){
      wx.navigateTo({
        url: '/pages/doc_information/doc_information',
      })
    },
    my3:function(){
      wx.navigateTo({
        url: '/pages/ys_zixunjilu/ys_zixunjilu',
      })
    },
    my4:function(){
      wx.navigateTo({
        url: '/pages/ys_order/ys_order',
      })
    },
    my5:function(){
      wx.navigateTo({
        url: '/pages/edit_ysda/edit_ysda',
      })
    },
    my6:function(){
      wx.navigateTo({
        url: '/pages/services/services',
      })
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})